import sys
from PyQt5.QtWidgets import (QApplication, QWidget,
                             QPushButton, QToolTip)
from PyQt5.QtCore import QCoreApplication

class Example(QWidget):

    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        self.setGeometry(100, 100, 300, 400)

        btn = QPushButton('Button', self)
        btn.resize(btn.sizeHint())
        btn.move(50,50)

        btn.clicked.connect(QCoreApplication.instance().quit)

        self.show()



if __name__ == '__main__':

    app = QApplication(sys.argv)
    win = Example()
    sys.exit(app.exec_())
